﻿using System.Windows;
using Caliburn.Micro;
using Microsoft.Win32;

namespace Scrabble.Tasks
{
    public static class Show
    {
        public static DisplayPopup<TScreen> Popup<TScreen>(TScreen screen) where TScreen : IScreen
        {
            return new DisplayPopup<TScreen>(screen);
        }

        public static OpenDialog<TDialog> Dialog<TDialog>() where TDialog : class, IDialog
        {
            var dialog = IoC.Get<TDialog>();
            IoC.BuildUp(dialog);
            return new OpenDialog<TDialog>(dialog);
        }

        public static ISelectFileTask OpenFileDialog()
        {
            return new SelectFileWith<OpenFileDialog>();
        }

        public static ISelectFileTask SaveFileDialog()
        {
            return new SelectFileWith<SaveFileDialog>();
        }

        public static IResult Notification(string message)
        {
            return new DelegatedTask(delegate
            {
                MessageBox.Show(message, Properties.Resources.Caption_Scrabble,
                    MessageBoxButton.OK, MessageBoxImage.Information);
                return false;
            });
        }
    }
}